/* eslint-disable @typescript-eslint/no-unused-vars */
import citycode from '@/components/assets/citycode.json';

export const addParkBase = {
  channelType: ['入口', '出口收费', '出口不收费'],
  autoRelease: ['固定车放行', '会员车放行', '无牌车放行', '临时车放行'],
  releaseMode: ['正常放行' /* , '软件异常放行', '遥控或遥感放行' */],
};

export const addListBase = {
  status: { '-1': '未知', 0: '待提交', 1: '已完成' },
};

export function getCity(e: number | string) {
  // const code = parkDetails?.addressCode ? parkDetails?.addressCode : 0;
  const code = e ? Number(e) : 0;
  const district = citycode[code || ''];
  if (code == 0 || code == undefined) {
    return '-';
  }
  if (String(code).endsWith('0000')) {
    return `${district}`;
  } else if (!String(code).endsWith('0000') && String(code).endsWith('00')) {
    const province = citycode[parseInt(String(code / 10000)) * 10000];
    return `${province} ${district}`;
  } else if (!String(code).endsWith('0000') && !String(code).endsWith('00')) {
    const province = citycode[parseInt(String(code / 10000)) * 10000];
    const city1 = citycode[parseInt(String(code / 100)) * 100];
    if (province == undefined) {
      return `${city1 || ''} ${district}`;
    } else {
      return `${province} ${city1 || ''} ${district}`;
    }
  }
  return '-';
}
